﻿-- Function: tesoreria.mestcta_insert_trigger()

-- DROP FUNCTION tesoreria.mestcta_insert_trigger();

CREATE OR REPLACE FUNCTION tesoreria.mestcta_insert_trigger()
  RETURNS trigger AS
$BODY$
begin

	if new.cperanio = '1996'    then insert into tesoreria.mestcta_a1996(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '1997' then insert into tesoreria.mestcta_a1997(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '1998' then insert into tesoreria.mestcta_a1998(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '1999' then insert into tesoreria.mestcta_a1999(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2000' then insert into tesoreria.mestcta_a2000(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2001' then insert into tesoreria.mestcta_a2001(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2002' then insert into tesoreria.mestcta_a2002(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2003' then insert into tesoreria.mestcta_a2003(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2004' then insert into tesoreria.mestcta_a2004(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2005' then insert into tesoreria.mestcta_a2005(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2006' then insert into tesoreria.mestcta_a2006(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2007' then insert into tesoreria.mestcta_a2007(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2008' then insert into tesoreria.mestcta_a2008(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2009' then insert into tesoreria.mestcta_a2009(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2010' then insert into tesoreria.mestcta_a2010(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2011' then insert into tesoreria.mestcta_a2011(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2012' then insert into tesoreria.mestcta_a2012(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2013' then insert into tesoreria.mestcta_a2013(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2014' then insert into tesoreria.mestcta_a2014(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2015' then insert into tesoreria.mestcta_a2015(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2016' then insert into tesoreria.mestcta_a2016(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2017' then insert into tesoreria.mestcta_a2017(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2018' then insert into tesoreria.mestcta_a2018(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2019' then insert into tesoreria.mestcta_a2019(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2020' then insert into tesoreria.mestcta_a2020(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2021' then insert into tesoreria.mestcta_a2021(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2022' then insert into tesoreria.mestcta_a2022(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2023' then insert into tesoreria.mestcta_a2023(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2024' then insert into tesoreria.mestcta_a2024(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	elsif new.cperanio = '2025' then insert into tesoreria.mestcta_a2025(idsigma, cidpers, cidpred, ctiping, ctiprec, cperiod, ncantid, imp_insol, fact_reaj, imp_reaj, fact_mora, imp_mora, costo_emis, dfecven, dfecpag, vobserv, nestado, vusernm, vhostnm, ddatetm, cperanio, mhresum, mpredio) values(new.idsigma, new.cidpers, new.cidpred, new.ctiping, new.ctiprec, new.cperiod, new.ncantid, new.imp_insol, new.fact_reaj, new.imp_reaj, new.fact_mora, new.imp_mora, new.costo_emis, new.dfecven, new.dfecpag, new.vobserv, new.nestado, new.vusernm, new.vhostnm, new.ddatetm, new.cperanio, new.mhresum, new.mpredio);
	else
		raise exception 'Periodo fuera de rango. Es necesario que se comunique con su administrador de base de datos.';
	end if;
	return null;
end;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;
ALTER FUNCTION tesoreria.mestcta_insert_trigger()
  OWNER TO postgres;
GRANT EXECUTE ON FUNCTION tesoreria.mestcta_insert_trigger() TO postgres;
GRANT EXECUTE ON FUNCTION tesoreria.mestcta_insert_trigger() TO public;
GRANT EXECUTE ON FUNCTION tesoreria.mestcta_insert_trigger() TO desarrollo;

ALTER TABLE tesoreria.mestcta ALTER COLUMN cidpred DROP NOT NULL;
COMMENT ON COLUMN tesoreria.mestcta.cidpred IS 'Código del predio del contribuyente';
